how to get maximum value from an array